# Copyright (c) 2015 by Michael Zahniser
#
# Endless Sky is free software: you can redistribute it and/or modify it under the
# terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any later version.
#
# Endless Sky is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.  See the GNU General Public License for more details.

conversation "assisting merchant"
	`When you repair the <origin>, the captain thanks you for your assistance and pays you <payment>.`
		decline

mission "Assisting Merchant (Small)"
	assisting
	repeat
	minor
	to offer
		random < 20
	source
		government "Merchant"
		category "Interceptor" "Light Warship" "Transport" "Light Freighter"
	on offer
		payment 10000
		conversation "assisting merchant"
	# A mission with no destination will not be offered, so give it one.
	# What the destination is doesn't matter, because you always 'decline' this.
	destination "Earth"

mission "Assisting Merchant (Medium)"
	assisting
	repeat
	minor
	to offer
		random < 15
	source
		government "Merchant"
		category "Medium Warship" "Heavy Freighter"
	on offer
		payment 20000
		conversation "assisting merchant"
	destination "Earth"

mission "Assisting Merchant (Large)"
	assisting
	repeat
	minor
	to offer
		random < 10
	source
		government "Merchant"
		category "Heavy Warship"
	on offer
		payment 30000
		conversation "assisting merchant"
	destination "Earth"



mission "Dangerous Journey"
	assisting
	minor
	name "Delivery to <planet>"
	description "Deliver <cargo> to <destination>. Payment is <payment>."
	to offer
		random < 10
	source
		government "Merchant"
		category "Light Freighter" "Heavy Freighter"
	destination
		government "Republic" "Syndicate" "Free Worlds"
		attributes "frontier"
		distance 2 3
	cargo random 5 2 .1
	on offer
		conversation
			`When you repair the <origin>, the captain hails you. "This is the fourth time I've nearly died in the past week doing this job! Here, take this <cargo> to <destination> and finish this job for me. They said the payment is <payment>."`
			choice
				`	(Take the cargo.)`
					accept
				`	(Don't take the cargo.)`
			`	The captain begins loudly swearing, so you cut the feed. Hopefully they make it to their destination in one piece.`
					decline
	on complete
		payment 7500
		dialog `You drop off your cargo of <commodity>, explain how the original merchant who took the job quit and handed off the cargo to you, and collect your payment of <payment>.`



conversation "assisting law enforcement"
	`The captain of the <origin> thanks you for repairing them, but informs you that the pirates that disabled them are only a smaller part of a fleet attacking <destination>.`
	`	The authorities of <planet> will probably pay you quite well if you assist them, but this could also be an easy way to get yourself killed.`
	choice
		`	(Don't join the fight.)`
			decline
		`	(Join the defense fleet.)`
			accept

mission "Assisting Free Worlds"
	assisting
	repeat
	minor
	name "Defend <planet>"
	description "Defeat a pirate raid on <destination>."
	to offer
		"combat rating" > 100
		random < 5
	source
		government "Free Worlds"
		not category "Fighter" "Drone"
	destination
		government "Free Worlds"
		distance 2 4
	on offer
		conversation "assisting law enforcement"
	npc kill
		government "Pirate"
		personality heroic staying target harvests plunders
		system destination
		fleet "Large Southern Pirates" 2
		fleet "Small Southern Pirates"
	npc
		government "Free Worlds"
		personality heroic staying
		system destination
		fleet "Large Free Worlds"
	on complete
		payment 150000
		dialog phrase "generic pirate attack payment dialog"

mission "Assisting Republic"
	assisting
	repeat
	minor
	name "Defend <planet>"
	description "Defeat a pirate raid on <destination>."
	to offer
		"combat rating" > 100
		random < 5
	source
		government "Republic"
		not category "Fighter" "Drone"
	destination
		government "Republic"
		distance 2 4
	on offer
		conversation "assisting law enforcement"
	npc kill
		government "Pirate"
		personality heroic staying target harvests plunders
		system destination
		fleet "Large Northern Pirates" 2
		fleet "Small Northern Pirates"
	npc
		government "Republic"
		personality heroic staying
		system destination
		fleet "Small Republic" 2
	on complete
		payment 150000
		dialog phrase "generic pirate attack payment dialog"

mission "Assisting Deep Security"
	assisting
	repeat
	minor
	name "Defend <planet>"
	description "Defeat a pirate raid on <destination>."
	to offer
		"combat rating" > 100
		random < 5
	source
		government "Deep Security"
		not category "Fighter" "Drone"
	destination
		attributes "deep"
		distance 2 4
	on offer
		conversation "assisting law enforcement"
	npc kill
		government "Pirate"
		personality heroic staying target harvests plunders
		system destination
		fleet "Large Northern Pirates" 2
		fleet "Small Northern Pirates"
	npc
		government "Deep Security"
		personality heroic staying
		system destination
		fleet "Large Deep Security"
	on complete
		payment 150000
		dialog phrase "generic pirate attack payment dialog"

mission "Assisting Syndicate"
	assisting
	repeat
	minor
	name "Defend <planet>"
	description "Defeat a pirate raid on <destination>."
	to offer
		"combat rating" > 100
		random < 5
	source
		government "Syndicate"
		not category "Fighter" "Drone"
	destination
		government "Syndicate"
		distance 2 4
	on offer
		conversation "assisting law enforcement"
	npc kill
		government "Pirate"
		personality heroic staying target harvests plunders
		system destination
		fleet "Large Core Pirates" 2
		fleet "Small Core Pirates"
	npc
		government "Syndicate"
		personality heroic staying
		system destination
		fleet "Large Syndicate"
	on complete
		payment 150000
		dialog phrase "generic pirate attack payment dialog"



conversation "boarding pirate"
	`You make short-range scans of the <origin>'s outfits and cargo. Among the cargo, you find a crate full of credit chips worth <payment>. You drag the crate onto your ship before considering your next move.`
		decline

mission "Boarding Pirate (Small)"
	boarding
	repeat
	minor
	to offer
		random < 7
	source
		government "Pirate"
		category "Interceptor" "Light Warship" "Transport" "Light Freighter"
	on offer
		payment 50000
		conversation "boarding pirate"
	destination "Earth"

mission "Boarding Pirate (Medium)"
	boarding
	repeat
	minor
	to offer
		random < 5
	source
		government "Pirate"
		category "Medium Warship" "Heavy Freighter"
	on offer
		payment 100000
		conversation "boarding pirate"
	destination "Earth"

mission "Boarding Pirate (Large)"
	boarding
	repeat
	minor
	to offer
		random < 3
	source
		government "Pirate"
		category "Heavy Warship"
	on offer
		payment 150000
		conversation "boarding pirate"
	destination "Earth"



mission "Pirate Ambush"
	invisible
	boarding
	repeat
	minor
	deadline 1
	to offer
		"combat rating" > 100
		random < 5
	source
		government "Pirate"
		category "Interceptor" "Light Warship" "Transport" "Light Freighter"
	on offer
		conversation
			`You board the <origin>, but find no crew aboard. When you reach the cockpit of the ship, you look out into space to see an escape pod floating away. The <origin> is emitting a distress signal to nearby pirates, and a self destruct sequence has been activated! You run back to your ship and get ready to fight.`
				launch
	destination "Earth"
	npc kill
		government "Pirate"
		personality nemesis harvests plunders entering
		fleet "pirate raid" 2



mission "Pirate Mutiny"
	boarding
	minor
	description "Bring <bunks> ex-pirate crew members to <destination>."
	to offer
		random < 10
	source
		government "Pirate"
		category "Medium Warship" "Heavy Warship"
	destination
		government "Republic" "Free Worlds" "Syndicate" "Neutral" "Independent"
		distance 2 4
	passengers 10 20
	on offer
		conversation
			`When you board the <origin>, you find most of the crew already dead. One of the surviving crew members, who looks like a teenaged boy no older than 16, approaches you with his hands in the air. He explains that after the ship was disabled, a section of the crew decided to overthrow the tyrannical captain. He continues, saying how most pirate crew members are forced into servitude on pirate ships. The surviving <bunks> crew members beg you to bring them to <destination> so that they can escape from pirate slavery.`
			`	The fight seems to have damaged the ship beyond repair. It may not last much longer in the vacuum of space if you leave the pirates here.`
			choice
				`	(Help the pirate crew.)`
					launch
				`	(Leave the pirate crew.)`
					flee
	on complete
		payment 25000
		dialog `The pirate crew members thank you for bringing them to <planet>. One of them hands you a small payment of <payment>. You wish them all the best of luck with their new lives and part ways.`



mission "Assisting Hai"
	assisting
	repeat
	to offer
		random < 27
	source
		government "Hai"
	on offer
		payment 30000
		conversation
			`Knowing you risked your life to save the <origin>, the captain gives you <payment>.`
				decline
	destination "Hai-home"
